package springFive;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@ComponentScan
@Configuration
public class Config {
	@Bean
	public DeptDao getDeptDao() {
		return new DeptDao();
	}
	@Bean
	public DeptDao getUserDao() {
		return new DeptDao();
	}
	@Bean
	public DeptDao getLoginDao() {
		return new DeptDao();
	}
	@Bean
	public UserService getUserService(UserDao userDao,DeptDao deptDao) {
		UserService userService = new UserService();
		userService.setUserDao(userDao);
		userService.setDeptDao(deptDao);
		return userService;
		
	}
	@Bean
	public LoginService getLoginService(LoginDao loginDao) {
		LoginService loginService=new LoginService();
		loginService.setLoginDao(loginDao);
		return loginService;
	}

	@Bean
	public LoginAction getLoninAction(UserService userService, LoginService loginService) {
		return new LoginAction(userService,loginService);
	
	}
	
}
